// pages/order_searchDetail/order_searchDetail.js
const app = getApp()
Page({

  /**
   * 页面的初始数据
   */
  data: {
    roomTitle: '',
    listArr: [],
    totalPrice: '',
    soiId: '',
  },
  // 加载数据
  loadData(soiId, sriRid, reserveNumber, startTime, endTime) {
    var that = this;
    wx.showLoading({
      title: '加载中...',
    })

    console.log(app.baseNet + 'roomInfo/queryRoomPriceCalendarDetails?sriRid=' + sriRid + '&nums=' + reserveNumber + '&startTime=' + startTime + '&endTime=' + endTime)
    wx.request({
      url: app.baseNet + 'roomInfo/queryRoomPriceCalendarDetails',
      data: {
        orderId: soiId,
        sriRid: sriRid,
        nums: reserveNumber,
        startTime: startTime,
        endTime: endTime
      },
      method: 'POST',
      header: {
        'Content-Type': 'application/x-www-form-urlencoded'
      },
      success(res) {
        console.log(res.data)
        wx.hideLoading()
        if (res.data.messcode == '001') {
          that.setData({
            roomTitle: res.data.RoomPriceCalendarDetailsDto.roomTitle,
            listArr: res.data.RoomPriceCalendarDetailsDto.roomPriceCalendarList,
            totalPrice: res.data.RoomPriceCalendarDetailsDto.total,
          })
        } else if (res.data.messcode == '002') {
          // 没有数据
        } else {
          // 服务器异常
          
        }
      },
    })
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function(options) {
    var that = this;
    var startTime = options.startTime
    var endTime = options.endTime
    var soiId = options.soiId
    if (typeof soiId == 'undefined') {
      soiId = ''
    }
    if (typeof startTime == 'undefined') {
      startTime = ''
    }
    if (typeof endTime == 'undefined') {
      endTime = ''
    }
    that.loadData(soiId, options.sriRid, options.reserveNumber, startTime, endTime)
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function() {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function() {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function() {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function() {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function() {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function() {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function() {

  }
})